package com.briup.cms.service.impl;


import com.briup.cms.bean.Comment;
import com.briup.cms.dao.CommentMapper;
import com.briup.cms.service.ICommentService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class CommentServiceImpl implements ICommentService {
    @Resource
    private CommentMapper commentMapper;


    @Override
    public List<Comment> findAll() {
        return commentMapper.selectAll();
    }


    @Override
    public void deleteById(long id) {
        commentMapper.deleteById(id);

    }

    @Override
    public void saveOrupdate(Comment comment) {
      if (comment.getId()!=null){
          commentMapper.update(comment);
      }else {
          commentMapper.insert(comment);
      }
    }
}
